/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package deti.es.ukni.persistence.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author eurico
 */
@Entity
@Table(name = "VIDEO")
@NamedQueries({@NamedQuery(name = "Video.findAll", query = "SELECT v FROM Video v"), @NamedQuery(name = "Video.findByIdvideo", query = "SELECT v FROM Video v WHERE v.idvideo = :idvideo"), @NamedQuery(name = "Video.findByName", query = "SELECT v FROM Video v WHERE v.name = :name"), @NamedQuery(name = "Video.findByDescription", query = "SELECT v FROM Video v WHERE v.description = :description"), @NamedQuery(name = "Video.findByEmbeddedcode", query = "SELECT v FROM Video v WHERE v.embeddedcode = :embeddedcode"), @NamedQuery(name = "Video.findByDatecreation", query = "SELECT v FROM Video v WHERE v.datecreation = :datecreation")})
public class Video implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "IDVIDEO")
    private Integer idvideo;
    @Basic(optional = false)
    @Column(name = "NAME")
    private String name;
    @Basic(optional = false)
    @Column(name = "DESCRIPTION")
    private String description;
    @Basic(optional = false)
    @Lob
    @Column(name = "EMBEDDEDCODE")
    private String embeddedcode;
    @Basic(optional = false)
    @Column(name = "DATECREATION")
    @Temporal(TemporalType.DATE)
    private Date datecreation;
    @JoinColumn(name = "REFIDBAND", referencedColumnName = "IDBAND")
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private Band refidband;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "video", fetch = FetchType.EAGER)
    private Set<CommentVideo> commentVideoCollection;

    public Video() {
    }

    public Video(Integer idvideo) {
        this.idvideo = idvideo;
    }

    public Video(Integer idvideo, String name, String description, String embeddedcode, Date datecreation) {
        this.idvideo = idvideo;
        this.name = name;
        this.description = description;
        this.embeddedcode = embeddedcode;
        this.datecreation = datecreation;
    }

    public Integer getIdvideo() {
        return idvideo;
    }

    public void setIdvideo(Integer idvideo) {
        this.idvideo = idvideo;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getEmbeddedcode() {
        return embeddedcode;
    }

    public void setEmbeddedcode(String embeddedcode) {
        this.embeddedcode = embeddedcode;
    }

    public Date getDatecreation() {
        return datecreation;
    }

    public void setDatecreation(Date datecreation) {
        this.datecreation = datecreation;
    }

    public Band getRefidband() {
        return refidband;
    }

    public void setRefidband(Band refidband) {
        this.refidband = refidband;
    }

    public Set<CommentVideo> getCommentVideoCollection() {
        return commentVideoCollection;
    }

    public void setCommentVideoCollection(Set<CommentVideo> commentVideoCollection) {
        this.commentVideoCollection = commentVideoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idvideo != null ? idvideo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Video)) {
            return false;
        }
        Video other = (Video) object;
        if ((this.idvideo == null && other.idvideo != null) || (this.idvideo != null && !this.idvideo.equals(other.idvideo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "deti.es.ukni.persistence.entity.Video[idvideo=" + idvideo + "]";
    }

}
